#include "synwit_ui_framework/synwit_ui.h"
#include "synwit_ui_framework/synwit_ui_internal.h"
#include "screen_id.h"

#define REG_WIDGET_CLASS(cls) \
    extern void cls##_register(); \
    cls##_register();

#define REG_ACTION(cls) \
    extern void action_##cls##_register(); \
    action_##cls##_register();


void app_register_widget_classes(void)
{
    REG_WIDGET_CLASS(cls_artchar);
    REG_WIDGET_CLASS(cls_avi);
    REG_WIDGET_CLASS(cls_image);
    REG_WIDGET_CLASS(cls_levelimg);
    REG_WIDGET_CLASS(cls_screen);

    /*
     * Classes below are unused.
     */
    //REG_WIDGET_CLASS(cls_widget);
    //REG_WIDGET_CLASS(cls_button);
    //REG_WIDGET_CLASS(cls_label);
    //REG_WIDGET_CLASS(cls_checkbox);
    //REG_WIDGET_CLASS(cls_bar);
    //REG_WIDGET_CLASS(cls_slider);
    //REG_WIDGET_CLASS(cls_switch);
    //REG_WIDGET_CLASS(cls_image_btn);
    //REG_WIDGET_CLASS(cls_list);
    //REG_WIDGET_CLASS(cls_roller);
    //REG_WIDGET_CLASS(cls_dropdown);
    //REG_WIDGET_CLASS(cls_arc);
    //REG_WIDGET_CLASS(cls_touch);
    //REG_WIDGET_CLASS(cls_chart);
    //REG_WIDGET_CLASS(cls_textarea);
    //REG_WIDGET_CLASS(cls_imgroller);
    //REG_WIDGET_CLASS(cls_clock);
    //REG_WIDGET_CLASS(cls_canvas);
}

void app_register_actions(void)
{

    /*
     * Actions below are unused.
     */
    //REG_ACTION(goto_screen);
    //REG_ACTION(set_visibility);
    //REG_ACTION(set_text_color);
    //REG_ACTION(set_bg_color);
    //REG_ACTION(set_text);
    //REG_ACTION(set_font_by_name);
    //REG_ACTION(back);
    //REG_ACTION(set_text_with_color_and_font);
    //REG_ACTION(slide_to_screen);
    //REG_ACTION(play_avi);
    //REG_ACTION(pause_avi);
    //REG_ACTION(stop_avi);
    //REG_ACTION(replay_avi);
}

void app_register_screens(void)
{
    /*
     * 注册界面
     */
    REG_SCREEN(SCREEN001, screen001_cb_obj);
    REG_SCREEN(SCREEN_OPEN, open_cb_obj);
    REG_SCREEN(SCREEN002, screen002_cb_obj);

    app_register_widget_classes();
    app_register_actions();
}

